using System.Runtime.InteropServices;
using System.Text;

namespace Core
{
	internal static class NativeMethods
	{
		[DllImport("kernel32", CharSet = CharSet.Unicode)]
		internal static extern uint GetPrivateProfileInt(string section, string key, int def, string filePath);

		[DllImport("kernel32", CharSet = CharSet.Unicode)]
		internal static extern uint GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);

		[DllImport("kernel32", CharSet = CharSet.Unicode)]
		internal static extern bool WritePrivateProfileString(string section, string key, string val, string filePath);

		[DllImport("DKeyLib32.dll", CharSet = CharSet.Ansi, EntryPoint = "InitDll")]
		internal static extern int InitDll32(int nUlc, int nVerCode, string stHelpText);

		[DllImport("DKeyLib32.dll", CharSet = CharSet.Ansi, EntryPoint = "GetLicenseStatus")]
		internal static extern long GetLicenseStatus32(int nVerCode, string stHelpText);

		[DllImport("DKeyLib32.dll", CharSet = CharSet.Ansi, EntryPoint = "TransferKeyDlg")]
		internal static extern bool TransferKeyDlg32(string stHelpText);

		[DllImport("DKeyLib32.dll", EntryPoint = "IsLicenseValid")]
		internal static extern bool IsLicenseValid32();

		[DllImport("DKeyLib32.dll", CharSet = CharSet.Ansi, EntryPoint = "GetKeyCode")]
		internal static extern void GetKeyCode32(StringBuilder sKeyCode);

		[DllImport("DKeyLib64.dll", CharSet = CharSet.Ansi, EntryPoint = "InitDll")]
		internal static extern int InitDll64(int nUlc, int nVerCode, string stHelpText);

		[DllImport("DKeyLib64.dll", CharSet = CharSet.Ansi, EntryPoint = "GetLicenseStatus")]
		internal static extern long GetLicenseStatus64(int nVerCode, string stHelpText);

		[DllImport("DKeyLib64.dll", CharSet = CharSet.Ansi, EntryPoint = "TransferKeyDlg")]
		internal static extern bool TransferKeyDlg64(string stHelpText);

		[DllImport("DKeyLib64.dll", EntryPoint = "IsLicenseValid")]
		internal static extern bool IsLicenseValid64();

		[DllImport("DKeyLib64.dll", CharSet = CharSet.Ansi, EntryPoint = "GetKeyCode")]
		internal static extern void GetKeyCode64(StringBuilder sKeyCode);
	}
}
